package com.itheima.builder.demo2.after;

/**
 * @author zzw
 * @date 2025/9/27
 * @description 测试类(重构后)
 */
public class Phone {

    private final String cpu;
    private final String screen;
    private final String memory;
    private final String mainBoard;

    private Phone(Builder builder) {
        cpu = builder.cpu;
        screen = builder.screen;
        memory = builder.memory;
        mainBoard = builder.mainBoard;
    }

    public static final class Builder {
        private String cpu;
        private String screen;
        private String memory;
        private String mainBoard;

        public Builder() {}

        public Builder cpu(String val) {
            cpu = val;
            return this;
        }

        public Builder screen(String val) {
            screen = val;
            return this;
        }

        public Builder memory(String val) {
            memory = val;
            return this;
        }

        public Builder mainBoard(String val) {
            mainBoard = val;
            return this;
        }

        public Phone build() {
            return new Phone(this);
        }
    }

    @Override
    public String toString() {
        return "Phone{" +
               "cpu='" + cpu + '\'' +
               ", screen='" + screen + '\'' +
               ", memory='" + memory + '\'' +
               ", mainBoard='" + mainBoard + '\'' +
               '}';
    }
}